package ch11;

import java.util.Stack;
import java.util.Queue;
import java.util.LinkedList;

class _07_StackQueueEx {
	public static void main(String[] args) {
		Stack<Integer> st = new Stack<Integer>();
		Queue<Integer> q = new LinkedList<Integer>(); // There is no Queue class.

		st.push(0);
		st.push(1);
		st.push(2);

		q.offer(0);
		q.offer(1);
		q.offer(2);

		System.out.println("= Stack =");
		while (!st.empty()) System.out.println(st.pop());
		/*
		= Stack =
		2
		1
		0
		*/

		System.out.println("= Queue =");
		while (!q.isEmpty()) System.out.println(q.poll());
		/*
		= Queue =
		0
		1
		2
		*/
	}
}